// ChatClientDlg.h : header file
//

#pragma once
#include "afxwin.h"


// CChatClientDlg dialog
class CChatClientDlg : public CDialog
{
// Construction
public:
	CChatClientDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_CHATCLIENT_DIALOG };

	CString UserName() const { return m_strUserName; }
	void UserName(const CString& strVal) { m_strUserName = strVal; }

// Implementation
protected:
	HICON m_hIcon;

	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual void OnOK();

	virtual void OnCancel()
	{
		CChCConnect::Uninitialize();
		CDialog::OnCancel();
	}

private:
	void AddString(const CString& strMessage);
	COLORREF GetMessageColor(const CString& strMessage);
	CString GetFrom(const CString& strMessage);
	CString GetTo(const CString& strMessage);
	BOOL IsSystem(const CString& strMessage);

private:
	//gui
	CRichEditCtrl m_HisoricalBoard;
	CListBox m_UsersBoard;
	CString m_strInMessage;

private:
	//members
	CString m_strUserName;
	DECLARE_EASYSIZE;

protected:
	DECLARE_MESSAGE_MAP()
	//wizard
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();

	//menu
	afx_msg void OnFileConnect();
	afx_msg void OnFileDisconnect();
	afx_msg void OnFileConnectionSetings();
	afx_msg void OnFileExit();
	afx_msg void OnFileApperance();
	afx_msg void OnHelpAbout();

	//gui
	afx_msg void OnBnClickedButtonSend();
	afx_msg void OnSize(UINT nType, int cx, int cy);

	//socket events
	afx_msg LRESULT  OnAddMessage(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT  OnConnected(WPARAM wParam, LPARAM lParam);	
	afx_msg LRESULT  OnServerCloseConnection(WPARAM wParam, LPARAM lParam);	
	afx_msg LRESULT  OnBadLogin(WPARAM wParam, LPARAM lParam);	
	afx_msg LRESULT  OnAddUser(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT  OnRemoveUser(WPARAM wParam, LPARAM lParam);	
};
